<!doctype html>
<meta charset="utf-8">
<title>data URL image</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id=log></div>
<script>
setup({ single_test: true });

var c = document.createElement("canvas"),
    con = c.getContext("2d"),
    img = document.createElement("img")
img.src = ""
img.onload = () => {
  con.drawImage(img, 0, 0)
  var data = con.getImageData(0, 0, 10, 10) // should not throw as data URLs are same-origin
  for(var i = 0; i < data.data.length; i++) {
    var expected = ((i+1) % 4 == 0) ? 255 : 0
    assert_equals(data.data[i], expected)
  }
  c.toDataURL() // shouldn't throw either
  done()
}
</script>
